﻿using System;
using Newtonsoft.Json;

namespace Hx.Infrastructure.Authorization
{
    public class AccessTokenResult
    {
        [JsonProperty("access_token")]
        public string AccessToken { get; set; }

        [JsonProperty("token_type")]
        public string TokenType { get; set; }

        [JsonProperty("expires_in")]
        public int ExpiresIn { get; set; }

        [JsonIgnore]
        public DateTime LastGetTime { get; set; }

        [JsonIgnore]
        public double LastExpires
        {
            get { return DateTime.Now.Subtract(LastGetTime).TotalSeconds; }
        }
    }
}